﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MediatorPattern.DemoOne
{
    public class Sale
    {
        /// <summary>
        /// 銷售IBM電腦
        /// </summary>
        /// <param name="number"></param>
        public void sellIBMComputer(int number)
        {
            Stock stock = new Stock();

            Purchase purchase = new Purchase();

            if (stock.getStockNumber() < number)
            {
                purchase.buyIBMComputer(number);
            }

            stock.decrease(number);
        }

        /// <summary>
        /// 反饋銷售情況
        /// </summary>
        /// <returns></returns>
        public int getSaleStatus()
        {
            Random rand = new Random();
            int saleStatus = rand.Next(100);

            return saleStatus;
        }

        /// <summary>
        /// 折價處理
        /// </summary>
        public void offSale()
        {
            Stock stock = new Stock();

        }
    }
}
